package cn.spikego.advicelite.client.core.module.impl.combat

import cn.spikego.advicelite.client.AdviceLite
import cn.spikego.advicelite.client.core.module.Module
import cn.spikego.advicelite.client.core.module.ModuleCategory
import java.awt.event.KeyEvent

class HitboxModule : Module(
    "Hitbox",
    KeyEvent.VK_K,
    "Expands player hitboxes",
    ModuleCategory.COMBAT
    ) {

    companion object {
        var hitboxWidth: Float = 0.65f
        var hitboxHeight: Float = 1.9f
    }

    // 原始尺寸 0.6F, 1.8F
    override fun onEnable() {
        super.onEnable()
        try {
            val player = AdviceLite.getMinecraftUtil()?.getLocalPlayer()
            AdviceLite.getMinecraftUtil()?.setPlayerDimensions(player, hitboxWidth, hitboxHeight)
        } catch (e: Exception) {
            e.printStackTrace()
        }
    }

    override fun onDisable() {
        super.onDisable()
        try {
            val player = AdviceLite.getMinecraftUtil()?.getLocalPlayer()
            AdviceLite.getMinecraftUtil()?.setPlayerDimensions(player, 0.6f, 1.8f)
        } catch (e: Exception) {
            e.printStackTrace()
        }
    }
}